<% layout("/layouts/micro.html"){ %>
    <div class="layui-tab layui-tab-brief childrenBody">
      <ul class="layui-tab-title">
       	<li><a href="${ctx}/oa/oaNotify/">通知列表</a></li>
		<li class="layui-this">
			<a href="${ctx}/oa/oaNotify/form?id=${oaNotify.id}">通知
			<%if(shiro.hasPermission("oa:oaNotify:edit")){%>${oaNotify.status == '1' ? '查看' : isNotEmpty(oaNotify.id) ? '修改' : '添加'}<%}%>
			<%if(shiro.lacksPermission("oa:oaNotify:edit")){%>查看<%}%>
			</a>
		</li>
      </ul>
      <div class="layui-tab-content">
		<form id="inputForm" action="${ctx}/oa/oaNotify/save" method="post" class="layui-form">
			<input type="hidden" name="id" value="${oaNotify.id}"/>
			<#message content="${message!}"/>
			<div class="layui-form-item">
				<label class="layui-form-label">类型：</label>
				<div class="layui-input-inline">
					<select name="type" class="input-xlarge" lay-verify="required">
						<option value="" label=""/>
						<#options items="${@DictUtils.getDictList('oa_notify_type')}" value="${oaNotify.type}"/>
					</select>
				</div>
			</div>	
			<div class="layui-form-item">
				<label class="layui-form-label">标题：</label>
				<div class="layui-input-block">
					<input type="text" name="title" value="${oaNotify.title}" htmlEscape="false" maxlength="200" class="layui-input" lay-verify="required"/>
				</div>
			</div>
			<div class="layui-form-item">
				<label class="layui-form-label">内容：</label>
				<div class="layui-input-block">
					<textarea name="content" htmlEscape="false" rows="6" maxlength="2000" class="layui-textarea" lay-verify="required">${oaNotify.content}</textarea>
				</div>
			</div>
				<%if(oaNotify.status != '1'){%>
				<div class="layui-form-item">
					<label class="layui-form-label">附件：</label>
					<div class="layui-input-inline">
						<input type="hidden" id="files" name="files" htmlEscape="false" maxlength="255" class="input-xlarge"/>
						<#ckfinder input="files" type="files" uploadPath="/oa/notify" selectMultiple="true" readonly="false"/>
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">状态：</label>
					<div class="layui-input-inline">
						<#radio name="status" items="${@DictUtils.getDictList('oa_notify_status')}" value="${oaNotify.status}" />
					</div>
					<div class="layui-form-mid layui-word-aux">发布后不能进行操作。</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">接受人：</label>
					<div class="layui-input-block">
		                <#treeselect id="oaNotifyRecord" name="oaNotifyRecordIds" value="${oaNotify.oaNotifyRecordIds}" labelName="oaNotifyRecordNames" labelValue="${oaNotify.oaNotifyRecordNames}"
							title="用户" url="/sys/office/treeData?type=3" cssClass="input-xxlarge required" notAllowSelectParent="true" dataMsgRequired="true" checked="true"/>
					</div>
				</div>
			<%}else{%>
				<div class="layui-form-item">
					<label class="layui-form-label">附件：</label>
					<div class="layui-input-inline">
						<input type="hidden" id="files" name="files" htmlEscape="false" maxlength="255" class="input-xlarge"/>
						<#ckfinder input="files" type="files" uploadPath="/oa/notify" selectMultiple="true" readonly="true" />
					</div>
				</div>
				<div class="layui-form-item">
					<label class="layui-form-label">接受人：</label>
					<div class="layui-input-block">
						<table id="contentTable" class="layui-table" >
							<thead>
								<tr>
									<th>接受人</th>
									<th>接受部门</th>
									<th>阅读状态</th>
									<th>阅读时间</th>
								</tr>
							</thead>
							<tbody>
							<%for(oaNotifyRecord in oaNotify.oaNotifyRecordList){%>
								<tr>
									<td>
										${oaNotifyRecord.user.name}
									</td>
									<td>
										${oaNotifyRecord.user.office.name}
									</td>
									<td>
										${@DictUtils.getDictLabel(oaNotifyRecord.readFlag, 'oa_notify_read', '')}
									</td>
									<td>
										${oaNotifyRecord.readDate,dateFormat="yyyy-MM-dd HH:mm:ss"}
									</td>
								</tr>
							<%}%>
							</tbody>
						</table>
						已查阅：${oaNotify.readNum} &nbsp; 未查阅：${oaNotify.unReadNum} &nbsp; 总共：${oaNotify.readNum + oaNotify.unReadNum}
					</div>
				</div>
			<%}%>
			<div class="layui-form-item">
		    	<div class="layui-input-block">
					<%if(oaNotify.status != '1'){%>
		    		<%if(shiro.hasPermission("oa:oaNotify:edit")){%>
	      				<button class="layui-btn" lay-filter="*" lay-submit>保 存</button>
	      			<%}%>
					<%}%>
		       		<button type="reset" class="layui-btn layui-btn-primary" onclick="history.go(-1)">返回</button>
			    </div>
		  	</div>
		</form>
	</div>
</div>
<%}%>